<template>
  <div>
    <TeacherIndex v-if="role === roleConfig.teacher"></TeacherIndex>
    <StudentIndex v-if="role === roleConfig.student"></StudentIndex>
    <RootIndex v-if="role === roleConfig.root"></RootIndex>
  </div>
</template>
<script>
  import TeacherIndex from '../components/TeacherIndex'
  import StudentIndex from '../components/StudentIndex'
  import RootIndex from '../components/RootIndex'
  import { role } from '@/lib/config'
  export default {
    components: {
      TeacherIndex,
      RootIndex,
      StudentIndex
    },
    computed: {
      role() {
        const { role } = this.$store.getters.getUser
        return role
      }
    },
    data() {
      return {
        roleConfig: role
      }
    }
  }
</script>
